﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using ThoiTrang.Business;
using ThoiTrang.Entities;

public partial class Admin_adm_stats_report_det : System.Web.UI.Page
{
    public string ckid = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadSearch();
        }
    }

    void loadSearch()
    {
        a_Session ss = null;
        a_User usr = null;
        a_UserType usrType = null;
        //if (SessionManager.IsLogged)
        //{
        ss = a_SessionService.Geta_Session(SessionManager.GetCookie());
        ckid = ss.SessionID;
        usr = a_UserService.Geta_User(ss.CookieID);
        usrType = a_UserTypeService.Geta_UserType(usr.UserTypeID);

        ltrWellcome.Text = "Hi " + usr.Firstname + " " + usr.Lastname;
        int page = Convert.ToInt32(Request.QueryString["p"] == null ? "1" : Request.QueryString["p"]);

        DataSet ds = a_ArticleService.a_adm_stats_det_sel(
            Request.QueryString["fefid"],20,6,
            rdbQuickPeriod.Checked==true?0:1,
            ddlQuickPeriod.SelectedValue,txtDateFrom.Text,txtDateTo.Text,
            ddlSort.SelectedValue,ddlOrder.SelectedValue,
           page);

        if (ds.Tables.Count > 1)
        {
            GridView1.DataSource = ds.Tables[1];
            GridView1.DataBind();
           
            // ltrPaging.Text = CommonFunc.QueryPaging(page, Convert.ToInt32(dtbPaging.Rows[0]["TotalRecords"]) / 20 + 1, 6);
        }
        else
        {
            ltrPaging.Text = "No item found";
        }
    }
}
